<template>
    <div class="fontc0 tl wrap bgwhite">
        <mt-header fixed title="提现记录">
            <router-link to="/account/withdraw" slot="left">
                <mt-button icon="back" @click="$emit('hideRecod')">返回</mt-button>
            </router-link>
        </mt-header>
       <main class="mt50 bgwhite">
           <ol>
               <li
                    class="ml10 mr10"
                    v-for="(item,idx) in list"
                    :key="idx">
                    <h5 class="fs18 lh30 mt10">{{item.money}}元</h5>
                    <p class="clearfix mb10">
                        <span class="fl fontc2">{{item.createTime}}</span>
                        <span class="fr" :class="item.status===3?'red':'green'">{{getText(item.status)}}</span>
                    </p>
                </li>
               <li class="lh50 tc lh50 fontc3"> - 只显示最近50条记录 - </li>
           </ol>
       </main>
    </div>
</template>
<script>
import axios from "axios";
import { MessageBox } from "mint-ui";

export default {
  name: "Record",
  data() {
    return {
      offset: 0,
      list: []
    };
  },
  props: {
    hideRecod: {
      type: Function,
      required: false
    }
  },
  created() {
    this.getList();
  },
  methods: {
    getText(state) {
      switch (state) {
        case 0:
          return "提现发起";
        case 1:
          return "审批通过";
        case 2:
          return "转账中";
        case 3:
          return "提现成功";
        case 4:
          return "拒绝提现";
        case 5:
          return "提现失败";
        default:
          return "未知状态";
      }
    },
    getList() {
      // /user/finance/findIOList.do

      axios({
        method: "post",
        url: "/user/finance/findIOList.do",
        params: {
          type: -1,
          offset: 0,
          size: 50
        }
      }).then(res => {
        res = res.data;
        if (res.code === 200) {
          this.list = res.data;
        } else {
          MessageBox("提现记录", res.msg);
        }
      });
    }
  },
  filters: {}
};
</script>
<style scoped>
li {
  border-top: 1px solid #e2e2e2;
}
</style>
